package viper0

import (
	"fmt"
	"github.com/spf13/pflag"
	"github.com/spf13/viper"
)


//从命令行参数中读取
//go run test.go --ip=192.168.7.3 --port=3306
func LoadFromCmd() {
	pflag.String("ip", "127.0.0.1", "Server running address")
	pflag.Int64("port", 8080, "Server running port")
	pflag.Parse()

	viper.BindPFlags(pflag.CommandLine)
	fmt.Printf("ip :%s , port:%s", viper.GetString("ip"), viper.GetString("port"))


}

